using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Microsoft.Practices.Repository.Configuration
{
    /// <summary>
    /// Configuration element used to specify the mapping between 
    /// a repository interface and a repository concrete implementation.
    /// </summary>
    [Serializable]
    public class RepositoryElement : ConfigurationElement
    {
        /// <summary>
        /// Gets or sets the repository interface type name.
        /// </summary>
        [ConfigurationProperty("interfaceType")]
        public string InterfaceType
        {
            get { return (string)this["interfaceType"]; }
            set { this["interfaceType"] = value; }
        }
        
        /// <summary>
        /// Gets or stes the repository implementation type name.
        /// </summary>
        [ConfigurationProperty("repositoryType")]
        public string RepositoryType
        {
            get { return (string)this["repositoryType"]; }
            set { this["repositoryType"] = value; }
        }

        /// <summary>
        /// Creates a new instance of RepositoryElement.
        /// </summary>
        public RepositoryElement() {}

        /// <summary>
        /// Creates a new instance of RepositoryElement.
        /// </summary>
        /// <param name="interfaceType">Type name of the repository interface.</param>
        /// <param name="repositoryType">Type name of the repository implementation.</param>
        public RepositoryElement(string interfaceType, string repositoryType)
        {
            this.InterfaceType = interfaceType;
            this.RepositoryType = repositoryType;
        }
    }
}
